/* Replication code for models other than Table 8 and STM results */ 


use "replication_dta.dta"


/* Table 2 */

logit adopted ifor_justif1-ifor_justif60 /* M1 */
logit adopted ifor_justif1-ifor_justif60 ifor1-ifor40 ifor47-ifor52 /* M2 */


/* Table 3 */
lasso logit adopted ifor_justif1-ifor_justif60, selection(plugin) /* M1 */
lassocoef, display(coef, penalized) sort(coef, penalized)

/* Note: ifor_justif .. 17 = Fiscal ; 24 = Liberalize ; 38 = Income ; 54 = Presentation ; 60 = Welfare */

lasso logit adopted ifor_justif1-ifor_justif60, selection(cv) /* M2 */
lassoknots
lassoselect id=11
lassocoef, display(coef, penalized) sort(coef, penalized)


elasticnet logit adopted ifor_justif1-ifor_justif60 /* M3 */
lassoknots
lassoselect id=17
lassocoef, display(coef, penalized) sort(coef, penalized)


/* Table 4 */
logit adopted i.ifor_justif17 i.ifor_justif24 i.ifor_justif38 i.ifor_justif54 i.ifor_justif60

margins, dydx(*)
margins, at(ifor_justif17=0 ifor_justif38=1) at (ifor_justif17=1 ifor_justif38=0) post
lincom _b[2._at] - _b[1._at]

/* Table 5 */

lasso logit adopted ifor_justif1-ifor_justif60 if day<td(28nov1990), selection(plugin) /* M1 */
lassocoef, display(coef, penalized) sort(coef, penalized)

lasso logit adopted ifor_justif1-ifor_justif60 if day>=td(28nov1990) & day<td(02may1997), selection(plugin) /* M2 plugin */
lassocoef, display(coef, penalized) sort(coef, penalized)

lasso logit adopted ifor_justif1-ifor_justif60 if day>=td(28nov1990) & day<td(02may1997), selection(cv) /* M2 cv */
lassoknots
lassoselect id=6
lassocoef, display(coef, penalized) sort(coef, penalized)

lasso logit adopted ifor_justif1-ifor_justif60 if day>=td(02may1997), selection(plugin) /* M3 plugin */
lassocoef, display(coef, penalized) sort(coef, penalized)

lasso logit adopted ifor_justif1-ifor_justif60 if day>=td(02may1997), selection(cv) /* M3 cv */
lassoknots
lassoselect id=4
lassocoef, display(coef, penalized) sort(coef, penalized)

/* Table 6 */

lasso logit adopted ifor_justif* ifor1-ifor41 ifor47-ifor52, selection(plugin) /* M1 */
lassocoef, display(coef, penalized) sort(coef, penalized)

lasso logit adopted ifor_justif* ifor1-ifor40 ifor47-ifor52, selection(plugin) /* M2 */
lassocoef, display(coef, penalized) sort(coef, penalized)

replace firms = 0 if firms ==.
lasso logit adopted ifor_justif* ifor1-ifor40 ifor47-ifor52 firms, selection(plugin) /* M3 */
lassocoef, display(coef, penalized) sort(coef, penalized)

/* Table 7 */


lasso logit adopted ifor_justif1-ifor_justif60 if lca==1, selection(plugin) /* M1 plugin */
lassocoef, display(coef, penalized) sort(coef, penalized)

lasso logit adopted ifor_justif1-ifor_justif60 if lca==1, selection(cv) /* M1 cv */
lassoknots
lassoselect id=11
lassocoef, display(coef, penalized) sort(coef, penalized)


/* lasso subsets */
lasso logit adopted ifor_justif1-ifor_justif60 if discussion >=1, selection(plugin) /* M2 */
lassocoef, display(coef, penalized) sort(coef, penalized)

lasso logit adopted ifor_justif1-ifor_justif60 if discussion >=3, selection(plugin) /* M3 */
lassocoef, display(coef, penalized) sort(coef, penalized)

lasso logit adopted ifor_justif1-ifor_justif60 if elec12mo==1, selection(plugin) /* M4 plugin */
lassocoef, display(coef, penalized) sort(coef, penalized)


lasso logit adopted ifor_justif1-ifor_justif60 if elec12mo==1, selection(cv) /* M4 cv */
lassoknots
lassoselect id=6
lassocoef, display(coef, penalized) sort(coef, penalized)



/* Table 8 */

lasso logit adopted ifor_justif1-ifor_justif60 if indexnum[_n]==indexnum[_n-1] | indexnum[_n]==indexnum[_n+1], selection(plugin) /* M1 */
lassocoef, display(coef, penalized) sort(coef, penalized)

/* Table 8 , M2 - M4 are estimated on a dataset with the discussion item as the unit of analysis */

use "data_ifor_justif_collapsed.dta"

lasso logit ifor_justif17 ifor_justif1-ifor_justif16 ifor_justif18-ifor_justif60, selection(plugin) /* M1 */
lassocoef, display(coef, penalized) sort(coef, penalized)

lasso logit ifor_justif38 ifor_justif1-ifor_justif37 ifor_justif39-ifor_justif60, selection(plugin) /* M2 */
lassocoef, display(coef, penalized) sort(coef, penalized)


lasso logit ifor_justif54 ifor_justif1-ifor_justif53 ifor_justif55-ifor_justif60, selection(cv) /* M4 */
lassocoef, display(coef, penalized) sort(coef, penalized)


/* End of tables in main body */

/* Appendix 3 */




/* Appendix 5 */

/* Table A5.1 */

/* Thatcher 1 */
lasso logit adopted ifor_justif1-ifor_justif60 if day<td(09jun1983), selection(plugin)
lassocoef, display(coef, penalized) sort(coef, penalized)

lasso logit adopted ifor_justif1-ifor_justif60 if day<td(09jun1983), selection(cv)
lassoknots
lassoselect id=10
lassocoef, display(coef, penalized) sort(coef, penalized)

/* Thatcher 2 */
lasso logit adopted ifor_justif1-ifor_justif60 if day>=td(09jun1983) & day<td(11jun1987), selection(plugin)
lassocoef, display(coef, penalized) sort(coef, penalized)

lasso logit adopted ifor_justif1-ifor_justif60 if day>=td(09jun1983) & day<td(11jun1987), selection(cv)
lassoknots
lassoselect id=11
lassocoef, display(coef, penalized) sort(coef, penalized)

/* Thatcher 3 */
lasso logit adopted ifor_justif1-ifor_justif60 if day>=td(11jun1987) & day<td(28nov1990), selection(plugin)
lassocoef, display(coef, penalized) sort(coef, penalized)

lasso logit adopted ifor_justif1-ifor_justif60 if day>=td(11jun1987) & day<td(28nov1990), selection(cv)
lassoknots
lassoselect id=7
lassocoef, display(coef, penalized) sort(coef, penalized)

/* Table A5.2 */

/* Major 1 */
lasso logit adopted ifor_justif1-ifor_justif60 if day>=td(28nov1990) & day<td(09apr1992), selection(plugin)
lassocoef, display(coef, penalized) sort(coef, penalized)

lasso logit adopted ifor_justif1-ifor_justif60 if day>=td(28nov1990) & day<td(09apr1992), selection(cv)
lassoknots
lassoselect id=8
lassocoef, display(coef, penalized) sort(coef, penalized)

/* Major 2 */
lasso logit adopted ifor_justif1-ifor_justif60 if day>=td(09apr1992) & day<td(02may1997), selection(plugin)
lassocoef, display(coef, penalized) sort(coef, penalized)

lasso logit adopted ifor_justif1-ifor_justif60 if day>=td(09apr1992) & day<td(02may1997), selection(cv)
lassoknots
lassoselect id=6
lassocoef, display(coef, penalized) sort(coef, penalized)

/* Blair */
lasso logit adopted ifor_justif1-ifor_justif60 if  day>td(02may1997), selection(plugin)
lassocoef, display(coef, penalized) sort(coef, penalized)

lasso logit adopted ifor_justif1-ifor_justif60 if  day>td(02may1997), selection(cv)
lassoknots
lassoselect id=10
lassocoef, display(coef, penalized) sort(coef, penalized)



/* Table A5.3 */

/* M1 */
lasso logit adopted ///
	ifor_justif9 ///
	ifor_justif17 ///
	ifor_justif22 ///
	ifor_justif24 ///
	ifor_justif31 ///
	ifor_justif37 ///
	ifor_justif38 ///
	ifor_justif41 ///
	ifor_justif44 ///
	ifor_justif54 ///
	ifor_justif55 ///
	ifor_justif60 ///
	ifor_coherence ///
	ifor_justice ///
    ifor_defence ///
    ifor_growth  ///
    ifor_public_services ///
    ifor_elect ///
	,selection(plugin)
lassocoef, display(coef, penalized) sort(coef, penalized)

/* M2 */
lasso logit adopted ifor_justif1-ifor_justif23 ifor_justif25-ifor_justif60 ifor_justif_lib ifor_justif_privatis, selection(plugin)
lassocoef, display(coef, penalized) sort(coef, penalized)

/* Table A5.4 */

lasso logit adopted ifor_justif1-ifor_justif60 [iw=disc1], selection(plugin) /* M1 */
lassocoef, display(coef, penalized) sort(coef, penalized)

lasso logit adopted ifor_justif1-ifor_justif60 if paper==1, selection(plugin) /* M2 plugin */
lassocoef, display(coef, penalized) sort(coef, penalized)

lasso logit adopted ifor_justif1-ifor_justif60 if paper==1, selection(cv) /* M2 cv */
lassoknots
lassoselect id=9
lassocoef, display(coef, penalized) sort(coef, penalized)

lasso logit adopted ifor_justif1-ifor_justif60 if govlose==1, selection(cv) /* M3 */
lassoknots
lassoselect id=4
lassocoef, display(coef, penalized) sort(coef, penalized)

/* Table A5.5 */

lasso logit adopted ifor1-ifor40 ifor42-ifor52, selection(plugin) /* M1 */
lassocoef, display(coef, penalized) sort(coef, penalized)

/* Table A5.6 */

lasso logit adopted ifor_justif1-ifor_justif60 nagent, selection(plugin) /* M1 */
lassocoef, display(coef, penalized) sort(coef, penalized)

/* Table A5.7 */

lasso logit adopted ifor_justif1-ifor_justif60 if other_motiv==1, selection(plugin) /* M1 */
lassocoef, display(coef, penalized) sort(coef, penalized)

lasso logit adopted ifor_justif1-ifor_justif60 if other_motiv2==1, selection(plugin) /* M2 */
lassocoef, display(coef, penalized) sort(coef, penalized)





